{% extends 'index.html' %}
{% block content %}
 <div class="breadcrumbs">
        <div class="breadcrumbs-inner">
            <div class="row m-0">
                <div class="col-sm-4">
                    <div class="page-header float-left">
                        <div class="page-title">
                            <h1>京乳时鲜 &emsp;&emsp;&emsp;</h1>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <div class="page-header float-right">
                        <div class="page-title">
                            <ol class="breadcrumb text-right">
                                <li><a href="{% url 'index' %}">主页</a></li>
                                <li class="active">订单详情</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="content">
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header">
                        <h4>订单查看</h4>
                    </div>
                    <div class="card-body">
                        <div class="tab-pane fade show active" id="pills-seg" role="tabpanel" aria-labelledby="pills-seg-tab">
                            <div class="card-header">订单：{{order.o_id}}</div>
                                <div class="table-stats order-table ov-h" style="width: 60%; float:left; display: inline-block">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th class="serial">#</th>
                                                <th class="avatar">商品ID</th>
                                                <th>商品名</th>
                                                <th>数量</th>
                                                <th>单价</th>
                                                <th>Status</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            {% for i in shop_list %}
                                            <tr>
                                                <td class="serial">{{ forloop.counter }}.</td>
                                                <td> {{i.item.p_id.p_ID}} </td>
                                                <td>  <span class="name">{{i.item.p_id.p_name}}</span> </td>
                                                <td>{{i.item.number}}</td>
                                                <td> <span class="product">{{i.item.price}}</span> </td>
                                                <td>
                                                    {% ifequal i.sufficient 1 %}
                                                        <a href="#"><span class="badge badge-complete">可供货</span></a>
                                                    {% else %}
                                                        <a href="#"><span class="badge badge-pending">缺货</span></a>
                                                    {% endifequal %}
                                                </td>
                                            </tr>
                                            {% endfor %}
                                        </tbody>
                                    </table>
                                </div> <!-- /.table-stats -->
                                <div class="card-body" style="width:39%; display:inline-block">
                                    <div class="mx-auto d-block">
                                        <img class="rounded-circle mx-auto d-block" src="/static/images/admin.jpg" alt="Card image cap">
                                        <h5 class="text-sm-center mt-2 mb-1">客户名{{ order.customer.c_name }}</h5>
                                        <div class="location text-sm-center"><i class="fa fa-map-marker"></i> {{order.customer.c_address}}</div>
                                        <div class="text-sm-center mt-2 mb-1">备注:{{order.memo}}</div>
                                        <div class="text-sm-center mt-2 mb-1">产生时间:{{order.start_time|date:"Y-m-d H:i:s"}}</div>
                                        <br/><br/>
                                        <div class="stat-digit">总金额:{{order.money}}</div>
                                    </div>
                                    <hr>
                                    <div class="card-text text-sm-center">
                                        {% ifequal order.status "未发货" %}
                                        <form method="post">{% csrf_token %}<input value="提交订单并生成发货任务" type="submit" class="btn btn-primary" /></form>
                                        {% else %}<form method="post">{% csrf_token %}<input value="已发货" type="submit" class="btn btn-primary" disabled="disabled" /></form> {% endifequal %}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<script>
    jQuery(document).ready(function ($) {
        $("#sales").addClass("active");
    })
</script>
{% endblock %}